#include "Board.h"
#include "VirtualPlayer.h"
#include "VirtualTextPlayer.h"
namespace{
    void print_color(std::ostream& output, Color color)
    {
        if(color == Black) output << "Black";
        else output << "White";
    }
}
void VirtualTextPlayer::get_move(Board const& board, int& row, int& col)
{
    VirtualPlayer machine(color_);
    machine.get_move(board, row, col);
    output_ << "plays ["
            << char('a'+row-1) << char('1'+col-1) << "]\n";
}
void VirtualTextPlayer::skip_move(const Board&)
{
    print_color(output_, color_);
    output_ << ": no valid move possible.\n";
}
void VirtualTextPlayer::win()
{
    print_color(output_, color_);
    output_ << " wins!\n";
}
void VirtualTextPlayer::tie()
{
    if(color_ == Black)
        output_ << "Game tied.\n";
    else
        output_ << "No winner!\n";
}
